<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<script src="../jQuery-2.1.4.min.js"></script>
		<title></title>
	</head>
	<body>
	<ul class="box-ul">
		<li id="1">
		<span class="chart-time" >
			<input class="time-input" 
					type="number" value="5" 
					placeholder="单位：分钟" 
					style="display: none;"
					onblur="zz(this)"
					/>
			<span class="time-text" onclick="bb(this);">xx</span>
		</span>
	</li>
	<li id="2">
		<span class="chart-time" >
			<input class="time-input" 
					type="number" value="5" 
					placeholder="单位：分钟" 
					style="display: none;"
					onblur="zz(this)"
					/>
			<span class="time-text" onclick="bb(this);">xx</span>
		</span>
	</li>
	</ul>
	<script>
	var endtimes=[];	
	
//	initTime();
function initTime(){
	console.log(1111)
	$(".box-ul li").each(function(){
		var id = $(this).attr('id');
		var val = $(this).find(".time-input").val();
		val = val*60*1000;
		endtimes[id] = val;
	});
	setInterval("refer()",1000);
	
}



function refer(){
	
	$(".box-ul li").each(function(){
		var id = $(this).attr('id');
		console.log("------------------------------")
		endtimes[id] = endtimes[id] -1000;
		if (endtimes[id]<=0) {
			console.log("aaaaaaaa")
//			document.getElementById("day"+id).innerHTML = "";
//			document.getElementById("hou"+id).innerHTML = "";
		} else {
			console.log("bbbbbbbbb")
//			console.log(endtimes[id])
//			console.log(id)
//			zzz(endtimes[id],id)
			timechange(endtimes[id],id);
		}
	});
		//window.setTimeout("refer()",1000);
}
function zzz(t,id){
	console.log(".....................")
	console.log(t)
	var a = t-2
	console.log(a)
//	console.log(id)
}

function timechange(t,id){
	var day = parseInt(t/(60*60000*24));
	var hou = parseInt((t/(60*60000))-(day*24));
	var min = parseInt((t/60000)-(day*24*60 + hou*60));
	var sec = parseInt(((t/1000)%60));
	var text=sec;
	if (min>0) {
		text = min +":"+text;
	}
	if (hou>0) {
		text = hou +":"+text;
	}
	if (day>0) {
		text = day+"天   "+text;
	}
	$("#"+id).find(".time-text").html(text);
}	
		
		
	</script>
	</body>
</html>
